/*
 * Copyright (c) 2022, tyustli
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-02-08     tyustli      first implementation
 */

#include <stdio.h>
#include <math.h>

int data_reverse(int value)
{
    int data = 0;

    while (value != 0)
    {
        data += (value % 10);
        value = value / 10;
        if (value)
            data *= 10;
    }

    return data;
}

int main(int argc, char **argv)
{
    printf("%d\r\n", data_reverse(12321));
    printf("%d\r\n", data_reverse(12345));
    printf("%d\r\n", data_reverse(6));
    printf("%d\r\n", data_reverse(38));

    return 0;
}

/******************** end of file **********************/
